import { get, post } from '@/utils/request'

export default class FlowOperationController {
  // 启动流程实例并且提交表单信息
  static startAndTakeUserTask(params, axiosOption) {
    let url = '/service-workflow/b/flow/flowOnlineOperation/v1/startAndTakeUserTask'
    if (axiosOption && axiosOption.processDefinitionKey) {
      url += '/' + axiosOption.processDefinitionKey
    }
    return post(url, params)
  }
  // 获得流程以及工单信息
  static listWorkOrder(params, axiosOption) {
    let url = '/service-workflow/b/flow/flowOnlineOperation/v1/listWorkOrder'
    if (axiosOption && axiosOption.processDefinitionKey) {
      url += '/' + axiosOption.processDefinitionKey
    }
    return post(url, params)
  }
  // 提交用户任务数据
  static submitUserTask(params) {
    return post(`/service-workflow/b/flow/flowOnlineOperation/v1/submitUserTask`, params)
  }
  // 获取历史流程数据
  static viewHistoricProcessInstance(params) {
    return get(`/service-workflow/b/flow/flowOnlineOperation/v1/viewHistoricProcessInstance`, params)
  }
  // 获取用户任务数据
  static viewUserTask(params) {
    return get(`/service-workflow/b/flow/flowOnlineOperation/v1/viewUserTask`, params)
  }
  // 获取在线表单工作流以及工作流下表单列表
  static listFlowEntryForm(params) {
    return get(`/service-workflow/b/flow/flowOnlineOperation/v1/listFlowEntryForm`, params)
  }
  // 撤销工单
  static cancelWorkOrder(params) {
    return post(`/service-workflow/b/flow/flowOperation/v1/cancelWorkOrder`, params)
  }
  // 多实例加签
  static submitConsign(params) {
    return post(`/service-workflow/b/flow/flowOperation/v1/submitConsign`, params)
  }
  // 已办任务列表
  static listHistoricTask(params) {
    return post(`/service-workflow/b/flow/flowOperation/v1/listHistoricTask`, params)
  }
  // 获取已办任务信息
  static viewHistoricTaskInfo(params) {
    return get(`/service-workflow/b/flow/flowOperation/v1/viewHistoricTaskInfo`, params)
  }
  // 仅启动流程实例
  static startOnly(params) {
    return post(`/service-workflow/b/flow/flowOperation/v1/startOnly`, params)
  }
  // 获得流程定义初始化用户任务信息
  static viewInitialTaskInfo(params) {
    return get(`/service-workflow/b/flow/flowOperation/v1/viewInitialTaskInfo`, params)
  }
  // 获取待办任务信息
  static viewRuntimeTaskInfo(params) {
    return get(`/service-workflow/b/flow/flowOperation/v1/viewRuntimeTaskInfo`, params)
  }
  // 获取流程实例审批历史
  static listFlowTaskComment(params) {
    return get(`/service-workflow/b/flow/flowOperation/v1/listFlowTaskComment`, params)
  }
  // 获取历史任务信息
  static viewInitialHistoricTaskInfo(params) {
    return get(`/service-workflow/b/flow/flowOperation/v1/viewInitialHistoricTaskInfo`, params)
  }
  // 获取所有待办任务
  static listRuntimeTask(params) {
    return post(`/service-workflow/b/flow/flowOperation/v1/listRuntimeTask`, params)
  }
  // 获得流程实例审批路径
  static viewHighlightFlowData(params) {
    return get(`/service-workflow/b/flow/flowOperation/v1/viewHighlightFlowData`, params)
  }
  // 获得流程实例的配置XML
  static viewProcessBpmn(params) {
    return get(`/service-workflow/b/flow/flowOperation/v1/viewProcessBpmn`, params)
  }
  // 获得所有历史流程实例
  static listAllHistoricProcessInstance(params) {
    return post(`/service-workflow/b/flow/flowOperation/v1/listAllHistoricProcessInstance`, params)
  }
  // 获得当前用户历史流程实例
  static listHistoricProcessInstance(params) {
    return post(`/service-workflow/b/flow/flowOperation/v1/listHistoricProcessInstance`, params)
  }
  // 终止流程
  static stopProcessInstance(params) {
    return post(`/service-workflow/b/flow/flowOperation/v1/stopProcessInstance`, params)
  }
  // 删除流程实例
  static deleteProcessInstance(params) {
    return post(`/service-workflow/b/flow/flowOperation/v1/deleteProcessInstance`, params)
  }
  // 催办
  static remindRuntimeTask(params) {
    return post(`/service-workflow/b/flow/flowOperation/v1/remindRuntimeTask`, params)
  }
  // 催办消息列表
  static listRemindingTask(params) {
    return post(`/service-workflow/b/flow/flowMessage/v1/listRemindingTask`, params)
  }
  // 驳回
  static rejectRuntimeTask(params) {
    return post(`/service-workflow/b/flow/flowOperation/v1/rejectRuntimeTask`, params)
  }
  // 驳回到起点
  static rejectToStartUserTask(params) {
    return post(`/service-workflow/b/flow/flowOperation/v1/rejectToStartUserTask`, params)
  }
  // 撤销
  static revokeHistoricTask(params) {
    return post(`/service-workflow/b/flow/flowOperation/v1/revokeHistoricTask`, params)
  }
  // 抄送消息列表
  static listCopyMessage(params) {
    return post(`/service-workflow/b/flow/flowMessage/v1/listCopyMessage`, params)
  }
  // 消息个数
  static getMessageCount(params) {
    return get(`/service-workflow/b/flow/flowMessage/v1/getMessageCount`, params)
  }
  // 在线表单流程抄送消息数据
  static viewOnlineCopyBusinessData(params) {
    return get(`/service-workflow/b/flow/flowOnlineOperation/v1/viewCopyBusinessData`, params)
  }
  // 静态表单流程抄送消息数据
  static viewCopyBusinessData(params) {
    return get(`/service-workflow/b/flow/flowOperation/v1/viewCopyBusinessData`, params)
  }
}
